home *** CD-ROM | disk | FTP | other *** search
-
- -- This can be set directly:
- LargeTextColor = Color(1,1,1,0)
-
- -- DON'T Set these directly:
- --TextFadeInDur = 1
- --TextWaitDur = 2.5
- --TextFadeOutDur = 1
- --TotalTextDur = TextFadeInDur + TextWaitDur + TextFadeOutDur
-
- function SetTextPopupTiming( inTime, waitTime, outTime )
- TextFadeInDur = inTime;
- TextWaitDur = waitTime;
- TextFadeOutDur = outTime;
- TotalTextDur = TextFadeInDur + TextWaitDur + TextFadeOutDur;
- end
-
- function ResetTextPopupTiming()
-
- SetTextPopupTiming( 1, 2.5, 1 )
- end
-
- ResetTextPopupTiming() -- Set defaults
-
-
- function KillTextPopup()
- if( not( TutorialText == nil ) and TutorialText.IsValid() ) then
- TutorialText.Destroy();
- end
- end
-
- function LargeTextPopup( text )
- if( TutorialText == nil or not(TutorialText.IsValid()) ) then
- G.Create( "MenuData/TutorialTextCog.xml" );
- end
-
- TutorialText.SetGuiPosition( "TutorialTextBox", Vector3(0,0,0) );
- TutorialText.SetGuiText( "TutorialTextBox", text, 0 );
-
- LargeTextColor[3] = 0;
- TutorialText.SetColor( "TutorialTextBox", LargeTextColor );
-
- TextFadeTime = TotalTextDur
- end
-
- function ColorTextPopup( text, color )
-
- LargeTextColor = color
- LargeTextPopup( text )
- end
-
-
- -- Popup icons too?
- function InvaderTextPopup( invaderName )
- ResetTextPopupTiming()
- ColorTextPopup( "New Invader: " .. invaderName .. "!", Color(0,0.85,0,1) )
- end
-
- function TrapTextPopup( trapName )
- ResetTextPopupTiming()
- ColorTextPopup( "New Trap: " .. trapName .. "!", Color(0.25,0.25,1,1) )
- end
-
-
-
- function TextFadeFunc()
- -- Fade text over time
- if( not( TutorialText == nil ) and TutorialText.IsValid() ) then
- TextFadeTime = TextFadeTime - GameTimeDiff;
-
- -- First Fade in:
- if( TextFadeTime > TextWaitDur + TextFadeOutDur ) then
- LargeTextColor[3] = (TotalTextDur - TextFadeTime) / TextFadeInDur;
- else
- if( TextFadeTime > TextFadeOutDur ) then
- LargeTextColor[3] = 1;
- else
- LargeTextColor[3] = TextFadeTime / TextFadeOutDur;
- end
- end
-
- TutorialText.SetColor( "TutorialTextBox", LargeTextColor );
-
- if( TextFadeTime < 0 ) then
- KillTextPopup()
- end
- end
- end
-
- -- Always update Function:
- GMain[ "TextFadeFunc" ] = TextFadeFunc;